#include "air32f10x_it.h"
#include "sys.h"

void NMI_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 1; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void HardFault_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 2; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void MemManage_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 3; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void BusFault_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 4; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void UsageFault_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 5; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void SVC_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 6; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void DebugMon_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 7; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void PendSV_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 8; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}

void SysTick_Handler(void)
{
  while (1)
  {
    for (uint8_t i = 0; i < 9; i++)
    {
      PAout(2) = 0;
      Delay_ms(100);
      PAout(2) = 1;
      Delay_ms(100);
    }
    Delay_ms(1000);
  }
}
